<template>
  <div id="app">
    <transition :name="transName" :mode="mode">
      <router-view :key="key" style="position:absolute" />
    </transition>
  </div>
</template>
<script>
export default {
  name: "app",
  data() {
    return {
      transName: "",
      mode: ""
    };
  },
  computed: {
    key() {
      return this.$route.fullPath;
    }
  },
  watch: {
    $route(to, from) {
      if (to.path === "/login") {
        this.transName = "slide-top";
        this.mode = "in-out";
      } else if (from.path === "/login") {
        this.transName = "slide-bottom";
        this.mode = "";
      } else {
        this.transName = "";
        this.mode = "";
      }
    }
  }
};
</script>

<style lang="scss"></style>
